//
// Created by benxb on 2021/10/2.
//
#include <vector>
#include <cstdlib>
#include <ctime>
#include <gtest/gtest.h>

TEST(SeqReadTest, TestSeqRange) {
    const int size = 160*1024/sizeof(int);
    std::vector<int> seq;
    std::pair<int, int> range = {20, 500};
    srand((unsigned)time(NULL));
    for (int i = 0; i < size; i++) {
        seq.push_back(rand()%1000);
    }
    std::vector<int> ans;
    for (int n : seq) {
        if (n >= range.first && n <= range.second) {
            ans.push_back(n);
        }
    }
    std::cout << ans.size() << std::endl;
}

TEST(SeqReadTest, TestSortRange) {
    const int size = 160*1024/sizeof(int);
    std::vector<int> sorted;
    std::pair<int, int> range = {20, 500};
    srand((unsigned)time(NULL));
    for (int i = 0; i < size; i++) {
        sorted.push_back(rand()%1000);
    }
    sort(sorted.begin(), sorted.end());
    std::vector<int> ans;
    for (int n : sorted) {
        if (n >= range.first && n <= range.second) {
            ans.push_back(n);
        }
    }
    std::cout << ans.size() << std::endl;
}

int main(int argc, char **argv) {
    testing::InitGoogleTest(&argc,argv);
    return RUN_ALL_TESTS();
}